<?php
require_once '../models/Product.php';

$action = $_REQUEST['action'];
if ($action == "add-series"){
	$brandID = $_REQUEST['brandID'];
	$modelID = $_REQUEST['modelID'];
	$seriesName = $_REQUEST['seriesName'];
	$checknull=true;
	$check=true;
	if($seriesName==null)
	{
		$checknull=false;
	}
	/*$check = Product::checkSeries($modelID,$brandID,$seriesName);*/
	if($checknull==true){
	if ($check == true){
		$re = Product::insertSeries($modelID,$brandID,$seriesName);
		if ($re){
			print('<span class="ok">Series is successfully inserted.<a href="ql_product.php">Click Add new Product</a></span>');
		}
		else print('<span class="error">System is busy. Please try again later.</span>');	
	}
	else print ('<span class="warning">This Series is already in use.</span>');
	}else echo "<span class='warning'>Not null!!!.</span>";
	//echo  Product::printSeriesTable('');
}
$action = $_REQUEST['action'];
if ($action == "print-series-drop"){
	$modelID = $_REQUEST['modelID'];
	Product::printSeriesDrop($modelID);
}
?>